package simple.demo.springintegration.demo.chapter5;

import org.springframework.integration.Message;
import org.springframework.integration.support.MessageBuilder;

public class MessageBuilderTestApp {

	private static final int COUNT = 1024 * 1024;

	public static void main(String[] args) throws Exception {
		int totalLength = 0;
		
		long begin = System.currentTimeMillis();
		for(int k=0; k<COUNT; ++k)
		{
			Message<String> msg = MessageBuilder.withPayload("hello world : " + k).build();
			String payload = msg.getPayload();
			totalLength += payload.length();			
		}
		
		long end = System.currentTimeMillis();
		
		System.out.println("Length = " + totalLength);
		System.out.println("time = " + (end - begin));
	}

}
